import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {LoginComponent} from './login/login.component';
import {AuthGuard} from './auth.guard';
import {LayoutComponent} from './layout/layout.component';
import {HomeComponent} from './home/home.component';
import {AdminListComponent} from './admin/admin-list.component';
import {BuildingListComponent} from './building/building-list.component';
import {RoomListComponent} from './room/room-list.component';
import {ResidentListComponent} from './resident/resident-list.component';
import {ChargeListComponent} from './charge/charge-list.component';
import {ParkingAreaListComponent} from './parking-area/parking-area-list.component';
import {ParkingChargeListComponent} from './parking-charge/parking-charge-list.component';
import {RepairRequestListComponent} from './repair-request/repair-request-list.component';
import {StaffListComponent} from './staff/staff-list.component';
import {FacilityListComponent} from './facility/facility-list.component';
import {FacilityMaintenanceRecordListComponent} from './facility-maintenance-record/facility-maintenance-record-list.component';
import {ChartListComponent} from './chart/chart-list.component';

export const routes: Routes = [
  { path: 'login', component: LoginComponent },
  {
    path: '',
    component: LayoutComponent,
    canActivate: [AuthGuard],
    children: [
      { path: '', redirectTo: '/Home', pathMatch: 'full' },
      { path: 'Home', component: HomeComponent },
      { path: 'AdminList', component: AdminListComponent },
      { path: 'BuildingList', component: BuildingListComponent },
      { path: 'RoomList', component: RoomListComponent },
      { path: 'ResidentList', component: ResidentListComponent },
      { path: 'ChargeList', component: ChargeListComponent },
      { path: 'ParkingAreaList', component: ParkingAreaListComponent },
      { path: 'ParkingChargeList', component: ParkingChargeListComponent },
      { path: 'RepairRequestList', component: RepairRequestListComponent },
      { path: 'StaffList', component: StaffListComponent },
      { path: 'FacilityList', component: FacilityListComponent },
      { path: 'FacilityMaintenanceRecordList', component: FacilityMaintenanceRecordListComponent },
      { path: 'ChartList', component: ChartListComponent }
    ]
  },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
